package main

import (
	"fmt"
	myhashmodule "gin_demo/my-hash-module"
	"github.com/gin-gonic/gin"
	"net/http"
)

func Hc(context *gin.Context)  {
	context.String(http.StatusOK, "ok")
}

func main() {
	// gin.SetMode(gin.DebugMode)
	gin.SetMode(gin.ReleaseMode)
	router := gin.Default()

	router.GET("/", func(context *gin.Context) {
		context.String(http.StatusOK, "Welcome to golang word!")
	})

	router.GET("/ping", func(context *gin.Context) {
		context.JSON(http.StatusOK, gin.H{
			"message": "pong",
		})
	})

	router.GET("/hc", Hc)
	router.POST("/", myhashmodule.ComputeHmacSha256Service)

	//err := router.Run(":3000")
	err := router.Run()
	if err != nil {
		fmt.Println(err)
		return 
	}
}
